Zip for WinRT
Reading a Zipped File Using a StreamReader

To read a zipped file using a StreamReader, add the following code. First make sure to add these Imports (Visual Basic)/using (C#) statements at the top of the code:

Visual Basic
Copy Code
Imports C1.C1Zip and Imports System.IO

C#
Copy Code
using C1.C1Zip; and using System.IO

Then add the following code:

Visual Basic
Copy Code
' Open a zip file.
Dim zip As New C1ZipFile()
zip.Open("c:\temp\myzipfile.zip")
' Open an input stream on any entry.
Dim ze As C1ZipEntry = zip.Entries("someFile.cs")
Dim s As Stream = ze.OpenReader()
' Open the StreamReader on the stream.
Dim sr As New StreamReader(s)
' Use the StreamReader, then close it.

C#
Copy Code
// Open a zip file.
C1ZipFile zip = new C1ZipFile();
zip.Open(@"c:\temp\myzipfile.zip");
// Open an input stream on any entry.
C1ZipEntry ze = zip.Entries["someFile.cs"];
Stream s = ze.OpenReader();
// Open the StreamReader on the stream.
StreamReader sr = new StreamReader(s);
// Use the StreamReader, then close it.
See Also

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback